<template>
  <div class="goods">
    <div class="menu-wrapper">
      <ul>
        <li v-for="item in goods" :key="item.name" class="menu-item">
          <span v-show="item.type>0" class="icon" :class="classMap[item.type]"></span><span class="text">{{ item.name }}</span>
        </li>
      </ul>
    </div>
    <div class="foods-wrapper"></div>
  </div>
</template>

<script>
export default {
  data () {
    return {
      goods: {}
    }
  },
  props: {
    seller: {}
  },
  created () {
    this.$http.get('/api/goods').then((res) => {
      res = res.body
      if (res.errno === 0) {
        this.goods = res.data
      }
    })
    this.classMap = ['decrease', 'discount', 'special', 'invoice', 'guarantee']
  }
}
</script>

<style lang="scss" scoped>
@media screen and (-webkit-min-device-pixel-ratio: 2.0) {
  .icon.decrease{
    background-image: url('./decrease_1@2x.png')
  }
  .icon.discount{
    background-image: url('./discount_1@2x.png')
  }
  .icon.guarantee{
    background-image: url('./guarantee_1@2x.png')
  }
  .icon.invoice{
    background-image: url('./invoice_1@2x.png')
  }
  .icon.special{
    background-image: url('./special_1@2x.png')
  }
}
@media screen and (-webkit-min-device-pixel-ratio: 3.0) {
  .icon.decrease{
    background-image: url('./decrease_1@3x.png')
  }
  .icon.discount{
    background-image: url('./discount_1@3x.png')
  }
  .icon.guarantee{
    background-image: url('./guarantee_1@3x.png')
  }
  .icon.invoice{
    background-image: url('./invoice_1@3x.png')
  }
  .icon.special{
    background-image: url('./special_1@3x.png')
  }
}
  .goods{
    position:absolute;
    width: 100%;
    top: 174px;
    display: flex;
    bottom: 46px;
    overflow: hidden;
    .menu-wrapper{
      flex: 0 0 80px;
      width: 80px;
      background: #f3f5f7;
      .menu-item{
        display: table;
        height: 54px;
        width: 56px;
        line-height: 14px;
        margin: 0 auto;
        text-align: center;
        padding: 0 auto;
        .icon{
          display: inline-block;
          width: 12px;
          height: 12px;
          background-size:12px 12px;
          background-repeat: no-repeat;
          vertical-align: top;
        }
        .text{
          font-size: 12px;
          color: rgb(240,20,20);
          font-weight:200;
          vertical-align: top;
        }
      }
    }
    .foods-wrapper{
      flex: 1
    }
  }
</style>
